package com.jdy.haoduoaiteacher.view.timesquare;//package com.jdy.haoduoaiteacher.view.timesquare;
//
//import java.text.DateFormat;
//import java.util.Calendar;
//import java.util.List;
//
//import android.content.Context;
//import android.util.AttributeSet;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.LinearLayout;
//import android.widget.TextView;
//
//import com.jdy.haoduoaiteacher.R;
//
///**
// * 
// * @author hf
// * 
// */
//public class MonthView extends LinearLayout {
//  TextView title;
//  CalendarGridView grid;
//  private Listener listener;
//  // 改签模式
//  private static boolean isResignDateMode;
//  // t0 p1
//  private int ticketType = 0;
//
//  public static MonthView create(ViewGroup parent, LayoutInflater inflater,
//      DateFormat weekdayNameFormat, Listener listener, Calendar today,
//      MonthDescriptor month, boolean bResignDateMode) {
//    isResignDateMode = bResignDateMode;
//    final MonthView view = (MonthView) inflater.inflate(R.layout.month, parent,
//        false);
//    final int originalDayOfWeek = today.get(Calendar.DAY_OF_WEEK);
//    // boolean isCurrentMonth = today.get(MONTH) == month.getMonth();
//    // int firstDayOfWeek = today.getFirstDayOfWeek();
//    final CalendarRowView headerRow = (CalendarRowView) view.grid.getChildAt(0);
//    headerRow.setVisibility(View.GONE);
//    today.set(Calendar.DAY_OF_WEEK, originalDayOfWeek);
//    view.listener = listener;
//    return view;
//  }
//
//  public MonthView(Context context, AttributeSet attrs) {
//    super(context, attrs);
//  }
//
//  @Override
//  protected void onFinishInflate() {
//    super.onFinishInflate();
//    title = (TextView) findViewById(R.id.title);
//    grid = (CalendarGridView) findViewById(R.id.calendar_grid);
//  }
//
//  public void init(MonthDescriptor month, List<List<MonthCellDescriptor>> cells) {
//
//    // ‘选择出发日期’页面中的年月title信息
//    title.setText(month.getLabel());
//
//    final int numRows = cells.size();
//    grid.setNumRows(numRows);
//    for (int i = 0; i < 6; i++) {
//      CalendarRowView weekRow = (CalendarRowView) grid.getChildAt(i + 1);
//      weekRow.setListener(listener);
//      if (i < numRows) {
//        weekRow.setVisibility(VISIBLE);
//        List<MonthCellDescriptor> week = cells.get(i);
//        for (int c = 0; c < week.size(); c++) {
//          MonthCellDescriptor cell = week.get(c);
//          CalendarCellView cellView = (CalendarCellView) weekRow.getChildAt(c);
//          if (cell instanceof BabyPlanMonthCellDescriptor) {
//            // ticketType = 0;
//            weekRow.setTicketType(0);
//            grid.setTicketType(0);
//          } else if (cell instanceof AirMonthCellDescriptor) {
//            // ticketType = 1;
//            weekRow.setTicketType(1);
//            grid.setTicketType(1);
//          }
//
//          if (cell instanceof BabyPlanMonthCellDescriptor) {
//            BabyPlanMonthCellDescriptor babyPlanCell = (BabyPlanMonthCellDescriptor) cell;
//            cellView.setResignDateMode(isResignDateMode);
//            cellView.setDayText(cell.getDayText());
//            cellView.setEnabled(cell.isCurrentMonth());
//            cellView.setSelectable(cell.isSelectable());
//            cellView.setSelected(cell.isSelected());
//            cellView.setCurrentMonth(cell.isCurrentMonth());
//            cellView.setToday(cell.isToday());
//            cellView.setGrab(babyPlanCell.isGrab());
//            cellView.setStudent(babyPlanCell.isStudent());
//            // cellView.setRangeState(cell.getRangeState());
//            cellView.setRest(babyPlanCell.isRest());
//            cellView.setDayHint(cell.getHintText(), cell.isSelected());
//            cellView.setTag(babyPlanCell);
//          } else if (cell instanceof AirMonthCellDescriptor) {
//            AirMonthCellDescriptor airCell = (AirMonthCellDescriptor) cell;
//            cellView.setResignDateMode(isResignDateMode);
//            cellView.setDayText(cell.getDayText());
//            cellView.setEnabled(cell.isCurrentMonth());
//            cellView.setSelectable(cell.isSelectable());
//            cellView.setSelected(cell.isSelected());
//            cellView.setCurrentMonth(cell.isCurrentMonth());
//            cellView.setToday(cell.isToday());
//            cellView.setGrab(false);
//            cellView.setStudent(false);
//            // cellView.setRangeState(cell.getRangeState());
//            if (airCell.getPrice() > 0) {
//              cellView.setPrice(airCell.getPrice());
//            }
//            cellView.setIfSpecialPrice(airCell.getIfSpeicalPrice());
//            cellView.setDayHint(cell.getHintText(), cell.isSelected());
//            cellView.setRest(airCell.isRest());
//            cellView.setTag(airCell);
//          }
//        }
//      } else {
//        weekRow.setVisibility(GONE);
//      }
//    }
//    // Logr.d("MonthView.init took %d ms", System.currentTimeMillis() - start);
//  }
//
//  public int getTicketType() {
//    return ticketType;
//  }
//
//  public void setTicketType(int ticketType) {
//    this.ticketType = ticketType;
//  }
//
//  public interface Listener {
//    void handleClick(MonthCellDescriptor cell);
//  }
// }
